# -- coding: utf-8 -- 
# Name: screenshotter

import win32gui,win32ui,win32con,win32api

hdesktop = win32gui.GetDesktopWindow()

width = win32api.GetSystemMetrics(win32con.SM_CXVIRTUALSCREEN)
height = win32api.GetSystemMetrics(win32con.SM_CYVIRTUALSCREEN)
left = win32api.GetSystemMetrics(win32con.SM_XVIRTUALSCREEN)
top = win32api.GetSystemMetrics(win32con.SM_YVIRTUALSCREEN)

desktop_dc = win32gui.GetWindowDC(hdesktop)
img_dc = win32ui.CreateDCFromHandle(desktop_dc)

mem_dc = img_dc.CreateCompatibleDC()

screenhost = win32ui.CreateBitmap()
screenhost.CreateCompatibleBitmap(img_dc,width,height)
mem_dc.SelectObject(screenhost)

mem_dc.BitBlt((0,0),(width,height),img_dc,(left,top),win32con.SRCCOPY)

screenhost.SaveBitmapFile(mem_dc,"C:\\123.bmp")

mem_dc.DeleteDC()
win32gui.DeleteObject(screenhost.GetHandle())